package com.huarun.common.util;

/**
 * 
 * @author hqy
 * @创建时间   2018-10-12 17:57
 * @Description 自定义异常
 */
public class MyException extends RuntimeException {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5079369740252350066L;
	private int errorCode = ResultCodeValue.R_UNKNOW;

	public MyException() {
		super();
	}

	public MyException(String format, Object... args) {
		super(String.format(format, args));
	}

	public MyException(Throwable cause, String format, Object... args) {
		super(String.format(format, args), cause);
	}

	public MyException(Throwable cause) {
		super(cause);
	}

	public MyException(int errorCode) {
		this.errorCode = errorCode;
	}

	public MyException(int errorCode, Throwable cause) {
		super(cause);
		this.errorCode = errorCode;
	}

	public MyException(int errorCode, String format, Object... args) {
		super(String.format(format, args));
		this.errorCode = errorCode;
	}

	public MyException(int errorCode, Throwable cause, String format, Object... args) {
		super(String.format(format, args), cause);
		this.errorCode = errorCode;
	}

	public int getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("BizException [errorCode=");
		builder.append(errorCode);
		builder.append(", getMessage()=");
		builder.append(getMessage());
		builder.append("]");
		return builder.toString();
	}

}
